import axios from 'axios'
import qs from 'qs'

export function login (form) {
  return axios({
    method: 'post',
    url: 'http://172.16.81.238/LoginSuccess',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(form)
  })
}

export function getWorker () {
  return axios.get('http://172.16.81.238/query_all/worker')
}

export function deleteWorker (id) {
  return axios({
    method: 'post',
    url: 'http://172.16.81.238/delete/worker',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(id)
  })
}

export function addWorker(form) {
  return axios({
    method: 'post',
    url: 'http://172.16.81.238/create/worker',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(form)
  })
}

export function getTrunkTrace(id) {
  return axios.get('http://172.16.81.238/query/truck_trace/' + id);
}

export function getPackagesByEventId(eventId) {
  return axios.get('http://172.16.81.238/query/transporting/' + eventId);
}

export function getSimpleBill() {
  return axios.get('http://172.16.81.238/query_all/bill/simple');
}

export function getServeBill() {
  return axios.get('http://172.16.81.238/query_all/bill/type');
}

export function getDetailBill() {
  return axios.get('http://172.16.81.238/query_all/bill/each');
}
